﻿Imports System.Drawing.Drawing2D
Imports System.Drawing
Imports System.Windows.Forms

Public Class observationctrl
    Dim temp As String
    Public Property Temperature As String
        Get
            Return temp
        End Get
        Set(value As String)
            temp = value
            Me.Invalidate()
        End Set
    End Property

    Dim loc As String
    Public Property LocationName As String
        Get
            Return loc
        End Get
        Set(value As String)
            loc = value
            Me.Invalidate()
        End Set
    End Property

    Dim cond As String

    Dim humid As String

    Dim wind As String

    Dim visib As String

    Dim press As String

    Private Sub observationctrl_Paint(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
        Dim rct As Rectangle = Me.ClientRectangle
        Dim g As Graphics = e.Graphics

        g.SmoothingMode = SmoothingMode.AntiAlias
        g.InterpolationMode = InterpolationMode.HighQualityBicubic
        'g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit

        Dim fnt As New Font("Segoe UI", 40)

        Dim txt_size As SizeF = g.MeasureString(temp, fnt)

        Dim rct_temp As New Rectangle(rct.X + 5, rct.Y, txt_size.Width + 40, txt_size.Height)

        g.DrawString(temp & "°", fnt, Brushes.Black, rct_temp, New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})

        Dim rct_location As New Rectangle(rct.X + 5, rct.Y + rct.Height - 35, 150, 35)

        g.DrawString("Location", New Font("Segoe UI", 9, FontStyle.Bold), Brushes.Black, rct_location, New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})

        g.DrawString(loc, New Font("Segoe UI", 9), Brushes.Black, rct_location, New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Far})

    End Sub
End Class
